package com.jingtai.platform.controller.shop;

import com.jingtai.core.entity.shop.Feedback;
import com.jingtai.platform.service.shop.FeedbackService;
import com.jingtai.platform.util.ResultUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.jingtai.validate.swagger.CApiParam;

/**
 * 反馈表
 *
 * @author sunlaiqian
 * @date 2020-12-02 18:31:31
 */
@Validated
@RestController
@RequestMapping("/platform/feedback")
@Api(tags = "反馈表")
public class FeedbackController{

    @Autowired
    private FeedbackService feedbackService;


    @ApiOperation("反馈表列表查询")
    @GetMapping("/list")
    public ResultUtil aopFeedbackList(@CApiParam(name = "page",value = "页数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("page") Integer page,
                              @CApiParam(name = "limit",value = "每页个数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("limit") Integer limit,
                              @CApiParam(name = "conditions",value = "查询条件",required = false) @RequestParam("conditions") String conditions){
        return feedbackService.Feedbacklist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询feedback实体")
    @GetMapping("/getFeedbackById")
    public ResultUtil GetFeedbackById(@CApiParam(name = "id",value = "feedback实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return feedbackService.getFeedbackById(id);
    }


    @ApiOperation("新增feedback实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"feedback.id","feedback.createTime","feedback.updateTime","feedback.deleteFlag"})
    public ResultUtil aopAddFeedback(@RequestBody @Validated Feedback feedback){
        return feedbackService.addFeedback(feedback);
    }

    @ApiOperation("编辑feedback实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"feedback.createTime","feedback.updateTime","feedback.deleteFlag"})
    public ResultUtil aopEditFeedback(@RequestBody @Validated Feedback feedback){
        return feedbackService.editFeedback(feedback);
    }

    @ApiOperation("根据ID删除feedback实体")
    @GetMapping("/delFeedbackById")
    public ResultUtil aopDelFeedbackById(@CApiParam(name = "id",value = "feedback实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return feedbackService.delFeedbackById(id);
    }

}






